package com.heima.search.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author xiaquanen
 * @version 1.0
 * @project heima-leadnews
 * @date 2024/7/29 16:21:04
 */
@Configuration
public class EsConfig {
    @Bean
    public RestHighLevelClient restHighLevelClient(EsconfigProperties esconfigProperties){
        return new RestHighLevelClient(RestClient.builder(HttpHost.create("http://"+esconfigProperties.getHost()+":"+esconfigProperties.getPort())));
    }
}
